<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="/common/common.jsp" %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>修改商品</title>
	<link href="${ctx}/static/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/static/dist/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
    <link href="${ctx}/static/css/basic.css" rel="stylesheet" type="text/css">
    <link href="${ctx}/static/plugins/layer/skin/default/layer.css" rel="stylesheet" type="text/css"/>
    <link href="${ctx}/static/plugins/validationEngine/css/validationEngine.jquery.css" rel="stylesheet" type="text/css">
     <style type="text/css">
          .red{color: red;}
        .head_title_margin{  margin: 40px;  }
        .head_title{color: #00afd6;font-size: 24px}
        .fa-2 {
            font-size: 2em;
        }
        #addInput i:hover{
            color: blue;
        }
 		select{
        	width: 200px;
        	line-height: 33px;
        	height: 33px;
        }
    </style>
</head>
<body>
<div class="content text-center"  >
    <form class="form-horizontal" id="updateForm">
        <div class="head_title_margin"><span class="head_title"><strong>基本信息</strong></span><hr></div>
        <div class="form-group">
            <label for="" class="col-sm-1 control-label"><span class="red">*</span>供应商:</label>
            <div class="col-sm-3">
                <select  id="supplierId" name="supplierId"  class="form-control">
<!--                 	<option value="-1">请选择供应商</option> -->
                	<c:forEach var="item" varStatus="status" items="${supplierList}">
                    	<option value="${item.id }" <c:if test="${item.id == phProductVo.supplierId}"> selected="selected"</c:if>>${item.supplierName}</option>
                    </c:forEach>
                </select>
                </select>
            </div>
            <label for="" class="col-sm-1 control-label"><span class="red">*</span>商品名称:</label>
            <div class="col-sm-3">
                <input type="text" class="form-control validate[required]"  name="productName" id="productName" value="${phProductVo.productName}"
                       placeholder="请输入商品名称" />
            </div>
            <label for="" class="col-sm-1 control-label"><span class="red">*</span>商品条形码:</label>
            <div class="col-sm-3">
                <input type="text" class="form-control"  name="barCode" id="barCode" value="${phProductVo.barCode}"
                       placeholder="商品条形码可以为空" />
            </div>
        </div>

        <div class="form-group">
            <label for="" class="col-sm-1 control-label"><span class="red">*</span>商品数量:</label>
            <div class="col-sm-3">
                <input type="text" class="form-control validate[required, custom[integer], min[1]]"  name="productCount" id="productCount" value="${phProductVo.productCount}"
                       placeholder="请输入商品数量" />
            </div>
            <label for="" class="col-sm-1 control-label">市场参考价:</label>
            <div class="col-sm-3">
                <input type="text" class="form-control validate[custom[number], min[0]]"  name="referencePrice" id="referencePrice" value="${phProductVo.referencePrice}"
                       placeholder="市场参考价可以为空" />
            </div>
            <label for="" class="col-sm-1 control-label"><span class="red">*</span>零售价:</label>
            <div class="col-sm-3">
                <input type="text" class="form-control validate[required,custom[number], min[0]]"  name="retailPrice" id="retailPrice" value="${phProductVo.retailPrice}"
                       placeholder="请输入零售价" />
            </div>
        </div>

        <div class="form-group">
            <label for="" class="col-sm-1 control-label"><span class="red">*</span>进货价:</label>
            <div class="col-sm-3">
                <input type="text" class="form-control validate[required,custom[number], min[0]]"  name="purchasePrice" id="purchasePrice" value="${phProductVo.purchasePrice}"
                       placeholder="请输入进货价" />
            </div>
            <label for="" class="col-sm-1 control-label"><span class="red">*</span>结算价:</label>
            <div class="col-sm-3">
                <input type="text" class="form-control validate[required,custom[number], min[0]]"  name="settlementPrice" id="settlementPrice" value="${phProductVo.settlementPrice}"
                       placeholder="请输入结算价" />
            </div>
            <label for="" class="col-sm-1 control-label"><span class="red">*</span>市级起批数量:</label>
            <div class="col-sm-3">
                <input type="text" class="form-control validate[required, custom[integer], min[1]]"  name="municipalBatchQuantity" id="municipalBatchQuantity" value="${phProductVo.municipalBatchQuantity}"
                       placeholder="请输入市级起批数量" />
            </div>
        </div>

        <div class="form-group">
            <label for="" class="col-sm-1 control-label"><span class="red">*</span>商户起批数量:</label>
            <div class="col-sm-3">
                <input type="text" class="form-control validate[required, custom[integer], min[1]]" name="sellerbAtchQuantity" id="sellerbAtchQuantity" value="${phProductVo.sellerbAtchQuantity}"
                       placeholder="请输入商户起批数量" />
            </div>
            <label for="" class="col-sm-1 control-label">起售数量:</label>
            <div class="col-sm-3">
                <input type="text" class="form-control validate[custom[integer], min[1]]"  name="saleQuantity" id="saleQuantity" value="${phProductVo.saleQuantity}"
                       placeholder="起售数量可以为空" />
            </div>
            <label for="" class="col-sm-1 control-label">物流费用:</label>
            <div class="col-sm-3">
                <input type="text" class="form-control validate[custom[number], min[0]]"  name="freight" id="freight" value="${phProductVo.freight}"
                       placeholder="物流费用可以为空" />
            </div>
        </div>
        <div class="head_title_margin"><span class="head_title"><strong>详细描述</strong></span><hr></h1></div>
        <div>
            <div class="form-group">
                <label for="" class="col-sm-1 control-label">详细描述:</label>
                <!-- 需要使用富文本 -->
                <div class="col-sm-11">
                <textarea class="form-control" rows="6" cols="276" id="description" >${phProductVo.description}</textarea>
                </div>
            </div>
        </div>
        <!-- -------------------------------------- 商品相册 -------------------------------------- -->
        <div class="head_title_margin"><span class="head_title"><strong>商品相册</strong></span><hr></div>
        <div class="form-group">
            <label class="col-sm-1 control-label">商品相册：</label>
            <div style="display: block;" id="existImage">
           	 <c:forEach var="img" varStatus="status" items="${phProductVo.phProductImageVoList}">
           	 	<div style="display: block;float: left;width: 250px; height: 150px;" class="existImageBox">
	           	 	<img src="${img.url}" width="200" height="100">
		    	</div>
			</c:forEach>
            </div>
        </div>
         <!-- -------------------------------------- //商品相册 -------------------------------------- -->
        
        <div class="head_title_margin"><span class="head_title"><strong>商品属性值</strong></span><hr></div>
        <div class="form-group">
			<label for="" class="col-sm-1 control-label"><span style="color: red">*</span>商品分类:</label>
            <div class="col-sm-3">
                <select id="first" >
                	<option value="-1" selected="selected">请选择分类</option>
                	<c:forEach var="item" varStatus="status" items="${pcL1List}">
                   		<option value="${item.id }" <c:if test="${item.id == pcvP1.id}"> selected="selected"</c:if>>${item.classifyName}</option>
                    </c:forEach>
                </select>
            </div>
            <div class="col-sm-3">
                <select id="second" >
               	 <option value="-1" selected="selected">请选择分类</option>
               	 <c:forEach var="item" varStatus="status" items="${pcL2List}">
                   	 <option value="${item.id }" <c:if test="${item.id == pcvParent.id}"> selected="selected"</c:if>>${item.classifyName}</option>
                    </c:forEach>
                </select>
            </div>
            <div class="col-sm-3">
                <select id="three" name="productClassifyId"  clas="validate[required,custom[number], min[1]]">
               	 <option value="-1" selected="selected">请选择分类</option>
               	 <c:forEach var="item" varStatus="status" items="${pcL3List}">
                   	 <option value="${item.id }" <c:if test="${item.id == phProductVo.productClassifyId}"> selected="selected"</c:if>>${item.classifyName}</option>
                    </c:forEach>
                </select>
            </div>
        </div>
        </div>
        <!-- 属性值 -->
        <div id="allProperty">
        	<c:forEach var="property" varStatus="status" items="${phProductVo.phProductPropertyVoList}">
        	<div class="form-group col-sm-12 ppvDiv" ide="${property.id}" classifyId=${property.classifyId }><!--  id="group" -->
			<label for="" class="col-sm-1 control-label"><span style="color: red">*</span>${property.propertyName }</label>
       		<c:forEach var="propertyVal" varStatus="status" items="${phProductVo.phProductPropertyValVoList}">
       			<c:if test="${propertyVal.propertyId == property.id}"> 
		            <div class="col-sm-1">
		                <input type="text" class="form-control pvcontent p_${property.id}" ide="${property.id}" name="content" value="${propertyVal.content }"
		                       placeholder="" />
		            </div>
		            </c:if>
            </c:forEach>
            </div>
           </c:forEach>
          </div> 
            <div class="form-group">
	            <div class="col-sm-12" style="text-align: center;">
	                <button type="button"   onclick="history.go(-1);"   class="btn btn-primary btn-10">返回</button>
	            </div>
	        </div>
        
    </div>
    <div id="imgHidden">
   
    </div>
    </form>
</div>
<script src="${ctx}/static/plugins/jQuery/jQuery-2.1.4.min.js"></script>
<script src="${ctx}/static/bootstrap/js/bootstrap.min.js"></script>
<script src="${ctx}/static/plugins/layer/layer.js"></script>
<script src="${ctx}/static/plugins/validationEngine/jquery.validationEngine-zh_CN.js"></script>
<script src="${ctx}/static/plugins/validationEngine/jquery.validationEngine.js"></script>
<script src="${ctx}/static/plugins/ckeditor/ckeditor.js"></script>
<script type="text/javascript">

/*添加删除属性表单*/
$(function () {
	$("#updateForm").validationEngine({ 
		promptPosition: "topRight", 
		validationEventTriggers:"keyup blur", 
		success :  false,
		failure : function() { callFailFunction()  }
		});
    $(".addppvInput").click(function (e) {
    	var group = $(e.target).parent().parent();
    	var ide =$(e.target).parent().attr("ide");
        var i= group.find("div[ref='add']").length;
        $(this).before('<div  ref="add" class="col-sm-1"><input type="text" ide="' + ide + '" name="content" class="form-control pvcontent p_' + ide + '"' + 
            ' placeholder="">');
	});
    //富文本编辑器初始化
    CKEDITOR.replace('description');
   //直接将配置内容写在function函数内即可
		$("body").find("input").attr("disabled","disabled");
		$("body").find("select").attr("disabled","disabled");
// 		$("body").find("select").attr("readonly","readonly");
});

CKEDITOR.editorConfig = function( config ) {
// 	config.skin='kama';  
config.allowedContent = false; // 是否允许使用源码模式进行编辑
	config.uiColor = '#f1e4db';
	config.language = 'zh-cn';
	config.width = 400;
	config.height =300;
	config.skin = 'v2';
// 	config.removePlugins = 'elementspath,resize'; // 移除编辑器底部状态栏显示的元素路径和调整编辑器大小的按钮
	
	config.forcePasteAsPlainText = true; // 是否强制复制过来的文字去除格式
	config.enterMode = CKEDITOR.ENTER_BR; // 编辑器中回车产生的标签CKEDITOR.ENTER_BR(<br>),CKEDITOR.ENTER_P(<p>),CKEDITOR_ENTER(回车)
	// 设置快捷键
	// 用于实现Ctrl + V进行粘贴
	// 无此配置，无法进行快捷键粘贴
	config.keystrokes = [
	[CKEDITOR.CTRL + 86 /* V */, 'paste']
	];
	
	// 设置快捷键，可能与浏览器冲突plugins/keystrokes/plugin.js
	// 用于实现Ctrl + V进行粘贴
	// 此配置将会启动粘贴之前进行过滤，若无此配置，将会出现粘贴之后才弹出过滤框
	config.blockedKeystrokes = [
	CKEDITOR.CTRL + 86
	];
	//设置编辑器里字体下拉列表里的字体

	//设置工具栏里面的工具 最主要的
	config.toolbar = [['Bold','Italic','Underline','Strike','FontSize','NumberedList','BulletedList','Outdent','Indent','JustifyLeft',
	'JustifyCenter','JustifyRight','Link','Unlink','TextColor','BGColor','Smiley','Table',
	'RemoveFormat','Source']];
// 	// 图片上传相关
// 	config.filebrowserImageUploadUrl = './upload'; // 图片上传路径
// 	config.image_previewText = ' '; // 图片信息面板预览区内容的文字内容，默认显示CKEditor自带的内容
// 	config.removeDialogTabs = 'image:advanced;image:Link'; // 移除图片上传页面的'高级','链接'页签 }
	}
</script>
</body>
</html>